package com.yhy.dubbo.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yhy.domain.Settings;
import com.yhy.dubbo.api.SettingsApi;
import com.yhy.mapper.SettingsMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class SettingsApiImpl implements SettingsApi {

    @Autowired
    private SettingsMapper settingsMapper;

    @Override
    public Settings findAdviceByUid(Long id) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("user_id",id);
        return settingsMapper.selectOne(queryWrapper);
    }

    @Override
    public void update(Settings setting) {
        settingsMapper.updateById(setting);
    }

    @Override
    public void save(Settings settings) {
        settingsMapper.insert(settings);
    }
}